package com.hnxxxy.statistics.mapper;

import com.hnxxxy.statistics.vo.JfDetailVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 *@author:zqh
 *@date：2020年5月27日17:13:16
 * 个人类型图
 **/

@Mapper
@Repository
public interface TypeMapMapper {

    /**
     * 个人饼图积分类型分类
     * @param userId
     * @return 返回类别的积分总数
     */
    @Select("SELECT certificate_type_name AS name,SUM(grade) AS score FROM jf_detail WHERE user_id = #{userId} GROUP BY certificate_type_name")
    List<JfDetailVo> findPerTypePie(int userId);

    /**
     * 每个学院的总分
     * @param
     * @return 每个学院总分
     */
    @Select("SELECT b.college AS name,SUM(a.score) AS score FROM jf_total a, cst_user b WHERE a.user_id=b.id GROUP BY b.college")
    List<JfDetailVo> findCollegeTypePie();

}
